/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.evote.monitoreo.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Mendoza
 */
@Entity
@Table(name = "ciudadano", catalog = "evote", schema = "")
@NamedQueries({
    @NamedQuery(name = "Ciudadano.findAll", query = "SELECT c FROM Ciudadano c"),
    @NamedQuery(name = "Ciudadano.findByIdCiudadano", query = "SELECT c FROM Ciudadano c WHERE c.idCiudadano = :idCiudadano"),
    @NamedQuery(name = "Ciudadano.findByNombre", query = "SELECT c FROM Ciudadano c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Ciudadano.findByPaterno", query = "SELECT c FROM Ciudadano c WHERE c.paterno = :paterno"),
    @NamedQuery(name = "Ciudadano.findByMaterno", query = "SELECT c FROM Ciudadano c WHERE c.materno = :materno"),
    @NamedQuery(name = "Ciudadano.findByDni", query = "SELECT c FROM Ciudadano c WHERE c.dni = :dni")})
public class Ciudadano implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idCiudadano", nullable = false)
    private Integer idCiudadano;
    @Column(name = "nombre", length = 45)
    private String nombre;
    @Column(name = "paterno", length = 45)
    private String paterno;
    @Column(name = "materno", length = 45)
    private String materno;
    @Column(name = "dni", length = 8)
    private String dni;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ciudadanoidCiudadano")
    private List<Candidato> candidatoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ciudadanoidCiudadano")
    private List<Elector> electorList;

    public Ciudadano() {
    }

    public Ciudadano(Integer idCiudadano) {
        this.idCiudadano = idCiudadano;
    }

    public Integer getIdCiudadano() {
        return idCiudadano;
    }

    public void setIdCiudadano(Integer idCiudadano) {
        this.idCiudadano = idCiudadano;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getPaterno() {
        return paterno;
    }

    public void setPaterno(String paterno) {
        this.paterno = paterno;
    }

    public String getMaterno() {
        return materno;
    }

    public void setMaterno(String materno) {
        this.materno = materno;
    }

    public String getDni() {
        return dni;
    }

    public void setDni(String dni) {
        this.dni = dni;
    }

    public List<Candidato> getCandidatoList() {
        return candidatoList;
    }

    public void setCandidatoList(List<Candidato> candidatoList) {
        this.candidatoList = candidatoList;
    }

    public List<Elector> getElectorList() {
        return electorList;
    }

    public void setElectorList(List<Elector> electorList) {
        this.electorList = electorList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCiudadano != null ? idCiudadano.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ciudadano)) {
            return false;
        }
        Ciudadano other = (Ciudadano) object;
        if ((this.idCiudadano == null && other.idCiudadano != null) || (this.idCiudadano != null && !this.idCiudadano.equals(other.idCiudadano))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.evote.monitoreo.entity.Ciudadano[idCiudadano=" + idCiudadano + "]";
    }

}
